﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;

namespace Kokomo.Controls
{
	public class ColorItem : IEquatable<ColorItem>
	{
		public ColorItem(
			Color color,
			string name
			)
		{
			this.Color = color;
			this.Name = name;
		}

		public override string ToString()
		{
			return string.Format("{0} (#{0:X2}{0:X2}{0:X2}{0:X2})",
				this.Name,
				this.Color.A,
				this.Color.R,
				this.Color.G,
				this.Color.B
				);
		}

		public override bool Equals(object obj)
		{
			if (!(obj is ColorItem)) return false;
			ColorItem other = (ColorItem)obj;
			return this.Equals(other);
		}
		public bool Equals(ColorItem other)
		{
			bool equals =
				(other.Color == this.Color)
				&& (other.Name == this.Name)
				;
			return equals;
		}

		public override int GetHashCode()
		{
			int hash =
				this.Color.GetHashCode()
				;

			return hash;
		}

		public Color Color { get; private set; }
		public string Name { get; private set; }
	}
}
